package cn.base.day07;

public class Student {
    // 学员编号（String）
    // 姓名（String）
    // 性别（String）
    // 身高（double） nextDouble
    // 年龄（int）   nextInt

    private String studentCode;
    private String name;
    private String gender;
    private double height;
    private int age;


    public Student(String studentCode, String name, String gender, double height, int age) {
        this.studentCode = studentCode;
        this.name = name;
        this.gender = gender;
        this.height = height;
        this.age = age;
    }

    //如果我们自己添加了有参构造 就不再提供无参构造了


    public Student(String studentCode, String name) {
        this.studentCode = studentCode;
        this.name = name;
    }

    //java默认提供无参构造
    public Student() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        System.out.println(this);
        this.name = name;
    }

    public String getStudentCode() {
        return studentCode;
    }

    public void setStudentCode(String studentCode) {
        this.studentCode = studentCode;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public void setAge(int age) {
        if (age < 0 || age > 150) {
            System.out.println("年龄错误");
            return;
        }
        this.age = age;
    }

    public int getAge() {
        return age;
    }
}
